home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / batch / tsbat36.zip / SCANZ.BAT < prev    next >
DOS Batch File  |  1992-08-07  |  5KB  |  183 lines

  1. echo off
  2. echo.
  3. echo ┌───────────────────────────────────────────────────────────┐
  4. echo │ Scan a zip file for viruses including execompressed files │
  5. echo │ By Prof. Timo Salmi, ts@chyde.uwasa.fi, Thu 6-Aug-1992    │
  6. echo └───────────────────────────────────────────────────────────┘
  7. echo.
  8.  
  9. rem If no parameters then give the instructions
  10. if "%1"=="" goto _help
  11.  
  12. rem First check that the zip file(s) exists
  13. if not exist %1 goto _err1
  14.  
  15. rem Check that you have the drive r: available (I have r: as ramdisk)
  16. if not exist r:\nul goto _err2
  17.  
  18. rem Check that the virus programs are available
  19. if not exist c:\tools\scan.exe goto _err3
  20. if not exist d:\virus\f-prot.exe goto _err4
  21. if not exist d:\virus\sign.def goto _err5
  22. if not exist d:\virus\virx.exe goto _novirx
  23.  
  24. rem Check that pkunzip.exe is available
  25. if not exist c:\tools\pkunzip.exe goto _err6
  26.  
  27. rem Check that exeuncompressors are available
  28. if not exist c:\tools\pklite.exe goto _err7
  29. if not exist c:\box\boxtools\unlzexe.exe goto _err8
  30. if not exist c:\box\boxtools\diet.exe goto _err9
  31.  
  32. rem Check that the ask.exe facility is available
  33. set _found=
  34. if exist ask.exe set _found=yes
  35. for %%d in (%path%) do if exist %%d\ask.exe set _found=yes
  36. for %%d in (%path%) do if exist %%dask.exe set _found=yes
  37. if not "%_found%"=="yes" goto _err10
  38.  
  39. rem Make a temporary directory and ensure that it is empty
  40. if not exist r:\tmp$$$\nul mkdir r:\tmp$$$
  41. if exist r:\tmp$$$\*.* echo Delete all old files from r:\TMP$$$ directory
  42. if exist r:\tmp$$$\*.* del r:\tmp$$$\*.*
  43.  
  44. rem Unzip all .exe, .com, overlay-files and embedded zips from the zipfile
  45. c:\tools\pkunzip %1 *.exe *.com *.ov* *.zip r:\tmp$$$
  46. if exist r:\tmp$$$\*.zip c:\tools\pkunzip r:\tmp$$$\*.zip r:\tmp$$$
  47. if exist r:\tmp$$$\*.zip del r:\tmp$$$\*.zip
  48. if errorlevel=1 goto _ziperror
  49.  
  50. rem Check for nasties with scan, first pass
  51. if exist r:\tmp$$$\*.* scan /a r:\tmp$$$\*.* /nomem
  52. if errorlevel=2 goto _scanerr
  53. if errorlevel=1 goto _virus
  54.  
  55. rem Check for nasties with virx, first and only pass
  56. :_ask_virx
  57. ask Perform virx virus check (y/n)? /d /u
  58. if errorlevel==89 if not errorlevel==90 goto _do_virx
  59. if errorlevel==78 if not errorlevel==79 goto _do_fprot
  60. goto _ask_virx
  61. :_do_virx
  62. if exist r:\tmp$$$\*.* d:\virus\virx -m -a -l -f -o r:\tmp$$$\*.*
  63.  
  64. rem Check for nasties with f-prot, first pass
  65. :_do_fprot
  66. if exist r:\tmp$$$\*.* d:\virus\f-prot r:\tmp$$$\*.* /all /nomem
  67. :_ask_fprot
  68. echo.
  69. ask Next second pass, with expansion, continue (y/n)? /d /u
  70. if errorlevel==89 if not errorlevel==90 goto _expand
  71. if errorlevel==78 if not errorlevel==79 goto _rmdir
  72. goto _ask_fprot
  73.  
  74. rem Expand execompressed files
  75. :_expand
  76. for %%f in (r:\tmp$$$\*.exe r:\tmp$$$\*.com) do c:\tools\pklite -x %%f
  77. for %%f in (r:\tmp$$$\*.exe r:\tmp$$$\*.com) do c:\box\boxtools\diet -ra %%f
  78. for %%f in (r:\tmp$$$\*.exe) do c:\box\boxtools\unlzexe %%f
  79. if exist r:\tmp$$$\*.olz del r:\tmp$$$\*.olz
  80.  
  81. :_nounlzexe
  82. rem Check for nasties with scan, second pass
  83. if exist r:\tmp$$$\*.* scan /a r:\tmp$$$\*.* /nomem
  84. if errorlevel=2 goto _scanerr
  85. if errorlevel=1 goto _virus
  86.  
  87. rem Check for nasties with f-prot, second pass
  88. if exist r:\tmp$$$\*.* d:\virus\f-prot r:\tmp$$$\*.* /all /nomem
  89. goto _rmdir
  90.  
  91. :_virus
  92. echo Viruses have been detected, batch terminated
  93. echo The infected files remain in directory r:\TMP$$$
  94. echo Take immediate measures to protect yourself
  95. goto _out
  96.  
  97. rem Error in zipfile
  98. :_ziperror
  99. echo Error in .zip file, batch terminated
  100.  
  101. rem Remove the temporary directory and its files
  102. :_rmdir
  103. if not exist r:\tmp$$$\*.* goto _chdir
  104. echo y | del r:\tmp$$$\*.* > nul
  105. :_chdir
  106. cd r:\
  107. if exist r:\tmp$$$\nul rmdir r:\tmp$$$
  108. goto _out
  109.  
  110. rem The instructions
  111. :_help
  112. echo Usage: SCANZ [ZipFileName]
  113. echo.
  114. echo You will need the following shareware and PD programs to use this batch.
  115. echo They are available from good BBSes or from garbo.uwasa.fi by anonymous ftp.
  116. echo    PKUNZIP.EXE from PKZ110.EXE or PKZ110EU.EXE
  117. echo    SCAN.EXE from SCANV93.ZIP
  118. echo    VIRX.EXE from VIRX23.ZIP
  119. echo    F-PROT.EXE and its auxiliary files from FP-203A.ZIP
  120. echo    PKLITE.EXE from PKLTE114.EXE
  121. echo    UNLZEXE.EXE from UNLZEXE7.ZIP
  122. echo    DIET.EXE from DIET144.ZIP
  123. echo    ASK.EXE from TSBAT36.ZIP
  124. echo Before using this batch you have to edit all the directory paths of this
  125. echo batch to correspond to your own configuration
  126. echo (or adjust your configuration :-).
  127. echo.
  128. echo.
  129. goto _out
  130.  
  131. :_err1
  132. echo File %1 not found
  133. goto _out
  134.  
  135. :_err2
  136. echo Drive R: not found
  137. echo Adjust your configuration or this batch
  138. goto _out
  139.  
  140. :_err3
  141. echo File c:\tools\scan.exe not found
  142. goto _out
  143.  
  144. :_err4
  145. echo File d:\virus\f-fchk.exe not found
  146. goto _out
  147.  
  148. :_err5
  149. echo File d:\tools\sign.txt not found
  150. goto _out
  151.  
  152. :_novirx
  153. echo File d:\virus\virx.exe not found
  154. goto _out
  155.  
  156. :_err6
  157. echo File c:\tools\pkunzip.exe not found
  158. goto _out
  159.  
  160. :_err7
  161. echo File c:\tools\pklite.exe not found
  162. goto _out
  163.  
  164. :_err8
  165. echo File c:\box\boxtools\unlzexe.exe not found
  166. goto _out
  167.  
  168. :_err9
  169. echo File c:\box\boxtools\diet.exe not found
  170. goto _out
  171.  
  172. :_err10
  173. echo Timo's ask.exe must be at path or current directory
  174. goto _out
  175.  
  176. :_scanerr
  177. echo Abnormal SCAN program termination
  178. goto _out
  179.  
  180. :_out
  181. set _found=
  182. echo on
  183.